/*
package com.demo.connectdbtest.export;

import cn.hutool.core.text.csv.CsvWriter;

import java.nio.file.Files;
import java.util.Collection;

public class CsvUtil2 {
    */
/**
     * csv文件导出
     *
     * @param data      导出数据
     * @param file      导出目的文件
     * @param separator 分割符
     * @param clazz     导出对象
     * @param <T>       数据对象泛型
     *//*

    public static <T> void export(Collection<T> data, File file, String separator, Class<T> clazz) {
        try {
            CsvWriterSettings settings = new CsvWriterSettings();
            //设置分隔符
            CsvFormat csvFormat = new CsvFormat();
            csvFormat.setDelimiter(separator);
            settings.setFormat(csvFormat);
            settings.setHeaderWritingEnabled(false);
            settings.setRowWriterProcessor(new BeanWriterProcessor<>(clazz));
            CsvWriter writer = new CsvWriter(Files.newOutputStream(file.toPath()), "utf-8", settings);
            // 写入header
            writer.writeHeaders(settings.getHeaders());
            data.forEach(writer::processRecord);
            writer.close();
        } catch (Exception e) {
            log.error("export .csv file failed. message.", e);
        }
    }



}
*/
